﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using RestSharp;
using Newtonsoft.Json.Linq;

namespace Tradier
{
    public partial class StreamQuotes : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            var accessToken = Session["UserTradierAccessToken"];
            if (accessToken == null)
            {
                Response.Redirect("/login.aspx");
            }

            var client = new RestClient("https://api.tradier.com");
            var request = new RestRequest("/v1/markets/events/session", Method.POST);

            request.AddHeader("Authorization", "Bearer " + accessToken);
            request.AddHeader("Content-type", "application/x-www-form-urlencoded");
            var result = (client.Execute(request).Content);
            var json = JObject.Parse(result);

        }
    }
}